//
//  MGTabPageView.h
//  Mango
//
//  Created by 胡超 on 2020/6/29.
//  Copyright © 2020 HuChao. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "MGTabPageBar.h"

NS_ASSUME_NONNULL_BEGIN

@class MGTabPageView;
@protocol MGTabPageViewDelegate <NSObject>
@optional
- (void)tabPageView:(MGTabPageView *)tabPageView didSelectPageAtIndex:(NSInteger)atIndex;
- (void)tabPageView:(MGTabPageView *)tabPageView didAddPage:(id)page;
@end

@interface MGTabPageView : UIView

@property (nonatomic,strong,readonly) MGTabPageBar *tabPageBar;
@property (nonatomic,strong,readonly) UIScrollView *scrollView;
@property (nonatomic,strong,readonly) NSArray *pages;
@property (nonatomic,strong,readonly) id selectedPage;

@property (nonatomic,assign) CGFloat barHeight;
@property (nonatomic,assign) NSInteger selectedPageIndex;

@property (nonatomic,weak) id<MGTabPageViewDelegate> delegate;

- (instancetype)initWithFrame:(CGRect)frame;
- (instancetype)initWithFrame:(CGRect)frame style:(nullable MGTabPageBarStyle *)style;

- (void)setPages:(NSArray *)pages titles:(NSArray<NSString *>*)titles parent:(nullable UIViewController *)parent;
- (void)removeAllPages;

- (void)setSelectedPageIndex:(NSInteger)selectedPageIndex animated:(BOOL)animated;

@end

NS_ASSUME_NONNULL_END
